require("../css/common.css")
require("../css/sports.less")
document.ready(function(){
    //调用登录拦截
    window.$utils.checkLogin()
    //调用公共的footer
    window.$utils.footer(1)
    let user=JSON.parse(localStorage.getItem("user")).userId
    //头部选项卡
    let exerciseTop=document.querySelectorAll(".top p span")
    let ms=document.querySelectorAll(" main>div")
    for(let i=0;i<exerciseTop.length;i++){
        exerciseTop[i].addEventListener("click",function(){
            for(let j=0;j<exerciseTop.length;j++){
                exerciseTop[j].classList.remove("active")
                ms[j].classList.remove("cur")
            }
            exerciseTop[i].classList.add("active")
            ms[i].classList.add("cur")
        })
    }
    //获取用户运动课程列表
    let contentBox=document.querySelector("#content_box")
    window.$http.get("/sports/courseList?id="+user,function(res){
        console.log(res);
        contentBox.innerHTML=`
        <div class="test-main">
                    <p>最新课程</p>
                    <a href="./course.html?id=3">
                        <div class="new">
                        <div class="bgi"></div>
                        <div class="text">
                            <p>巧克力腹肌雕刻</p>
                            <span>一场痛快淋漓的父级撕裂体验, 虐出你的巧克力腹肌 !</span>
                        </div>
                        </div>
                    </a> 
                    <p>课程</p>
                    <ul class="course">
                    <a href="./course.html?id=3">
                        <li><p>徒手胸肌训练进阶</p><span>男生专属变式俯卧撑训练, 在家也能练出钢铁般的胸肌</span></li>
                        <li><p>徒手胸肌训练进阶</p><span>男生专属变式俯卧撑训练, 在家也能练出钢铁般的胸肌</span></li>
                        <li><p>徒手胸肌训练进阶</p><span>男生专属变式俯卧撑训练, 在家也能练出钢铁般的胸肌</span></li>
                    </a> 
                    </ul>
                </div>
        `
    })
    
})